package com.tm.media.controller;

import com.tm.media.model.entity.ApUserFanEntity;
import com.tm.media.service.ApUserFanService;
import com.tm.media.utils.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Calendar;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

/**
 * @Author Ly
 * @Data 2023/3/3 9:48
 * @ClassName ApUserFanController
 */
@RestController
@RequestMapping("api/v1/user_fans")
public class ApUserFanController {
    @Autowired
    private ApUserFanService apUserFanService;
    @PostMapping("list")
    public Result list(@RequestBody ApUserFanEntity apUserFanEntity){
       return apUserFanService.apUserFanList(apUserFanEntity);
    }
    //获取粉丝的头像
    @PostMapping("avatar")
    public Result avatar(@RequestBody ApUserFanEntity apUserFanEntity){
        return apUserFanService.avatar(apUserFanEntity);
    }

  /*  public static  void main(String[] args) {
        System.out.println("开始");
         sss(5);
        System.out.println("Task scheduled.");
    }*/
/*       public static   void sss(int sec){
          Timer  timer = new Timer();
         timer.schedule(new TimerTask(){
         public void run(){
               System.out.println("结束");
                 timer.cancel();
           }
         }, sec*1000);
       }*/
  public class TimerTest02 {
      Timer timer;
      public TimerTest02(){
          Date time = getTime();
          System.out.println("指定时间time=" + time);
          timer = new Timer();
          timer.schedule(new TimerTaskTest02(), time);
      }
      public Date getTime(){
          Calendar calendar = Calendar.getInstance();
          calendar.set(Calendar.HOUR_OF_DAY, 11);
          calendar.set(Calendar.MINUTE, 39);
          calendar.set(Calendar.SECOND, 00);
          Date time = calendar.getTime();
          return time;
      }
  }
    public class TimerTaskTest02 extends TimerTask{
      @Override
      public void run() {
          System.out.println("指定时间执行线程任务...");
      }}

}
